package uc_admin

import (
	"context"
	"cronjob_work/internal/dao"
	"cronjob_work/internal/model/entity"
	"cronjob_work/internal/service"
)

type ucAdmin struct {
}

func (u *ucAdmin) AdminGetById(ctx context.Context, id int) (*entity.PpUcAdmin, error) {
	//TODO implement me
	panic("implement me")
}

func (u *ucAdmin) AdminGetList(ctx context.Context, page, pageSize int, filters map[string]interface{}) ([]*entity.PpUcAdmin, int64) {
	var da []*entity.PpUcAdmin
	err := dao.PpUcAdmin.Ctx(ctx).Where(filters).Limit(pageSize).Offset(page * pageSize).Scan(&da)
	if err != nil {
		return nil, 0
	}

	return da, int64(len(da))
}

func init() {
	service.RegisterUcAdmin(New())
}

func New() *ucAdmin {
	return &ucAdmin{}
}
